package kernel.test;

import junit.framework.TestCase;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Spring环境下的测试基类,继承于AbstractDependencyInjectionSpringContextTests.
 * <p/>
 * 该类带Spring的IOC能力,子类只要设置Setter即可获得依赖注入.
 * 实现了基类的getConfigLocations()函数,设置默认的applicationContext,在子类可重载该函数，减少载文件,加快速度.
 * 设置AUTOWIRE_BY_NAME ,因为Spring的测试基类默认为BY_TYPE,在有多个相同类型的Bean时冲突.
 * 
 * @author anders.lin
 * @see AbstractDependencyInjectionSpringContextTests
 */
public abstract class SpringTestCase extends TestCase {

	public ApplicationContext ctx = null;

	protected void setUp() throws Exception {
		ctx = new ClassPathXmlApplicationContext("spring/applicationContext*.xml");
	}
}
